// pages/my/yajin/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    yajin:0,
      dong_jie_yajin:0,
      zongyajin:0,
      kouchuyajin:0
  },
  mingxi:function(e){
    wx.navigateTo({
      url:'/pages/my/mingxi?type=3'
    })
  },
    doChongZhi:function(e){
        var that = this;
        wx.navigateTo({
            url:'/pages/my/yajin/dochongzhi'
        })
    },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.setData({
        yajin:getApp().globalData.userInfo.yajin,
        dong_jie_yajin:getApp().globalData.userInfo.dong_jie_yajin,
        zongyajin:parseFloat(getApp().globalData.userInfo.yajin) + parseFloat(getApp().globalData.userInfo.dong_jie_yajin)
    })
      this.getDataList();
  },

    tuihuan:function(){
      wx.showModal({
          title:'提示',
          content:'暂未开启'
      })
    },

    getDataList:function(e){
    var that = this;
      wx.request({
          url: getApp().data.server+'/index.php/Tongcheng/Book/getKouChuYaJin?uid='+getApp().globalData.userInfo.uid,
          success:res=>{
            console.log(res.data)
            that.setData({
              kouchuyajin: res.data==null?parseFloat(0).toFixed(2):parseFloat(res.data).toFixed(2)
            })
          }
      })
    },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})